import xlwt

txtname = '画图.txt'
excelname = '画图.xlsx'
 
fopen = open(txtname, 'r')
lines = fopen.readlines()
 
 
file = xlwt.Workbook(encoding='utf-8', style_compression=0)
#新建一个sheet
sheet = file.add_sheet('data')
 
i = 0
for line in lines:
    line = line.strip('\n')
    line = line.split(',')

    time = line[0]
    p1 = line[1]
    y1 = line[2]
    p2 = line[3]
    y2 = line[4]
    p3 = line[5]
    y3 = line[6]
 
    print(p1)
    # print(date)
    # print(baifenbi)
    # print(type(company_num))


    sheet.write(i, 0, time)
    sheet.write(i, 1, p1)
    sheet.write(i, 2, y1)
    sheet.write(i, 3, p2)
    sheet.write(i, 4, y2)
    sheet.write(i, 5, p3)
    sheet.write(i, 6, y3)

    i = i + 1
 
file.save(excelname)
